perm filename AL.PAL[PNT,HE]2 blob
sn#478458 filedate 1979-09-30 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 .TITLE AL INTERPRETER
C00006 00003 program initialization
C00013 ENDMK
C⊗;
.TITLE AL INTERPRETER
.OFFSET -160000 ;Load us into the high mem: virtual 0 → physical 160 000
;Comtab and dpatch area are in data space
.IFNDF CPOINTY
CPOINTY==0 ; unless otherwise stated this is not a POINTY compilation
.ENDC
;These need only be looked at during the first pass:
.IF1
.INSRT ALHEAD.PAL[AL,HE]
.INSRT K1DEF.PAL[11,SYS]
STSW KERNEL,1 ;1 => use the kernel
.ENDC
.OFFSET -340000 ;Load us into the zonker: virtual 0 → physical 340 000
;Start and ipatch area are in code space
;If DDT sends us to user I space this will start the Kernel up anyway
. = START
RESTRT ;EMT gets us into Kernel I space
BPT
BPT ;This is the INIT entry point to the Kernel
. = INTCOD
CODE$ == INTCOD ;Interpreter code & data spaces start here
DATA$ == INTDAT
SPSWITCH == 0 ;Make sure we start off with everyone properly defined
DATA
.PRINT / ALIO
/
.INSRT ALIO2.PAL[PNT,HE]
.PRINT / LARGEB
/
.INSRT LARGEB.PAL[AL,HE]
;Small block allocator
.PRINT / SMALLB
/
.INSRT SMALLB.PAL[AL,HE]
;The interpreter
.PRINT / INTERP
/
.INSRT INTERP.PAL[AL,HE]
; interpreter for pointy routines
.PRINT / PINTRP
/
.INSRT PINTRP.PAL[PNT,HE]
; display routines on the VT05
.PRINT / ALDISPLAY
/
.INSRT ALDISP.PAL[PNT,HE]
; routines talking to the 10
.PRINT / TALK10
/
.INSRT TALK10.PAL[PNT,HE]
;The floating I/O
.PRINT / FLOAT
/
.INSRT FLOAT.PAL[AL,HE]
;Graph structure
.PRINT / GRAPHS
/
.INSRT GRAPHS.PAL[AL,HE]
DATA ;Data areas
MAINBL:: PDBLK 1,20 ;Makes a process descriptor for main process
MAININ:: PDBLK 1,150,F ;Makes another PDB for the main (1st) interpreter
ISTBLK:: .BLKW ISBS ;Dummy interpreter status block (used in linking only)
PROLST:: .WORD 0 ;List of procedures currently active
ALLIVE:: .WORD 0 ;1 when AL is running, 0 otherwise
CODE
temp == %OFFSE ;Save the current offset
.OFFSET 0 ;We want to use real physical addresses here for the kernel
PUTLOC JOBDAT, MAINBL
PUTLOC JOBSA, AL
PUTLOC JOBDM, USRDM
.OFFSET temp ;Restore Offset
; program initialization
AL:
;initialize the world
MOV USKMAX+MAINBL,SP ;Make sure we have a good stack pointer
JSR PC,IOINIT ;Initialize input-output
EVWAIT CSLEVT ;Grab the console
MOV #STRMES,R0 ;Print AL runtime system message
JSR PC,TYPSTR
EVSIG CSLEVT ;Release the console
JSR PC,FRINIT ;Initialize free storage
JSR PC,SBINIT ;Initialize small block space
JSR PC,GSINIT ;Initialize graph structure
;check to see that the PCODE is compatible
CMP PCDVER,#PCVERSION ;Version compatible?
BEQ 1$ ;Yes
ALERR STMES ;No
1$: JSR PC,INIARM ;initialize the arm
;set up the first interpreter
JSR PC,INTINIT ;Initialize the interpreter events
MOV #ISBS,R0 ;R0 ← Size (in words) of an interpreter status block
JSR PC,GTFREE ;R0 ← LOC[new interpreter status block]
MOV R0,NXTINT+ISTBLK ;Prime the interpreter list.
CLR NXTINT(R0)
CLR PROLST ;Prime the active procedure list
MOV #PCODE,IPC(R0) ;new IPC ← interpreter start address
EVMAK ;-(SP) ← event for EVT in this interpreter
MOV (SP),EVT(R0) ;new EVT ← event just created.
MOV R0,-(SP) ;Save LOC[new interpreter status block]
MOV #INSTSZ,R0 ;R0 ← Size needed for an interpreter stack
JSR PC,GTFREE ;R0 ← LOC[new interpreter stack]
MOV (SP)+,R1 ;R1 ← LOC[new interpreter status block]
MOV R0,STKBAS(R1) ;Store away new stack base
ADD #2*INSTSZ,R0 ;R0 ← LOC[top of new stack] (INSTSZ is in bytes)
MOV #MAININ,R2 ;R2 ← LOC[main interpreter process descriptor]
BIS #UGRSAV+USKSAV,PDBSTA(R2) ;Use saved registers so we can set things up
MOV R0,PDBR3(R2) ;Store away new interp stack pointer (reg 3)
MOV R2,PDB(R1) ;Store away LOC[PDB] in new ISB
MOV R1,PDBR4(R2) ;Store away LOC[ISB] in reg 4 of PDB
MOV USKMAX(R2),USKP(R2) ;Make sure we have a good stack pointer
SCHEDU R2,#INTERP,#USRDM,#2 ;Cause the new process to be started, suspended
MOV #1,ALLIVE ;Let rest of world know we are alive
TST SAILID ;Do we need to talk to 10?
BEQ 42$ ;No, no need to start up POINTY
JSR PC,UPDINIT ;Initialize the updating
JSR PC,PNTINIT ;Yes, go initialize POINTY
42$: EVWAIT ;Wait for the return signal
BCC 5$ ;All well?
ALERR TSTMES ;No
5$: CLR ALLIVE ;done with the AL program
SLEEP #1000. ;give a chance for all the other jobs to die
EVWAIT CSLEVT ;Grab the console
MOV #ENDMES,R0 ;Print ALL DONE message
JSR PC,TYPSTR
EVSIG CSLEVT ;Release the console
DISMIS ;Go away
INIARM: TST LINTARM ;For debugging new systems - if the arm code hasn't been
BEQ 4$ ; loaded then don't try to initialize the arm
MOV #DVBKSZ,R0 ;Get a device block
JSR PC,GTFREE
MOV R0,R1
MOV R0,-(SP) ;Save address of device block so we can free it
JSR PC,@LINTARM ;Initialize the arm code
TST R0 ;All well?
BEQ 3$ ;Yes
CMP R0,#10 ;Is it the reference supply?
BNE 2$
ALERR STMES3 ; yup - complain about it.
BR 3$
2$: CMP R0,#7 ;Is it the power supply?
BNE 22$
ALERR STMES4 ; yup - complain about it.
BR 3$
22$: ALERR STMES2 ;Just make a general complaint.
3$: MOV (SP)+,R0 ;R0 ← LOC[device block]
JSR PC,RLFREE ;Release it
CMP ARMVER,#VERSION ;Arm compatible?
BEQ 4$ ;Yes
ALERR STMES1 ;No
4$: RTS PC
DATA
PNTMES:: ASCIE </CAN'T CONTINUE/>
STMES:: ASCIE </INCOMPATIBLE PCODE VERSION. PROCEED AT YOUR OWN RISK/>
STMES1:: ASCIE </INCOMPATIBLE ARM VERSION. PROCEED AT YOUR OWN RISK/>
STMES2:: ASCIE </CAN'T INITIALIZE ARM. ERROR CODE IN R0./>
STMES3:: ASCIE </CAN'T INITIALIZE ARM. REFERENCE POWER SUPPLY OUT OF RANGE./>
STMES4:: ASCIE </Can't initialize arm. Interface power supply turnd off/>
TSTMES:: ASCIE </BAD RETURN FROM MAIN INTERPRETER/>
STRMES:: ASCIE </
AL runtime system
/>
ENDMES:: ASCIE </
ALL DONE NOW. SEE YOU AROUND!
/>
PUTLOC SAILID, CPOINTY
PUTLOC LGETVAL, GETVAL
PUTLOC LGETARG, GETARG
PUTLOC LINVLDT, INVLDT
DATEND == . ;Get end of data address
.IF2
DATA
CODE
.INFO <First location after interpreter code = 340000 + >,\CODE$
.IFL 140000 - CODE$
.ERROR Interpreter code too large for available memory!
.ENDC
.INFO <Data ends at = >,\DATA$
.ENDC
.END START